/*
 * This source code is part of TWaver 4.0
 *
 * Serva Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Copyright 2002 - 2011 Serva Software. All rights reserved.
 */

package demo.network.topo.titlegroup;

import java.awt.Color;
import twaver.Group;
import twaver.TWaverConst;

public class TitleGroup extends Group {

    public TitleGroup() {
        init();
    }

    public TitleGroup(Object id) {
        super(id);
        init();
    }

    private void init() {
    	this.updateLabel();
    }

    public void setExpand(boolean expand) {
		super.setExpand(expand);
		this.updateLabel();
	}    
    
    private void updateLabel(){
		if (this.isExpand()) {
			this.putLabelPosition(TWaverConst.POSITION_TOPLEFT);
			this.putLabelBackground(Color.black);
			this.putLabelHighlightBackground(Color.blue.darker());
			this.putLabelColor(Color.white);
			this.putBorderVisible(false);
			this.putGroupHandlerVisible(false);
		} else {
			this.putLabelBackground(null);
			this.putLabelHighlightBackground(null);
			this.putLabelColor(null);
			this.putLabelPosition(TWaverConst.POSITION_BOTTOM);
			this.putBorderVisible(true);
			this.putGroupHandlerVisible(true);
		}   	
    }
    
    public String getUIClassID() {
        return TitleGroupUI.class.getName();
    }
}